﻿using System.Windows;

using System.Windows.Controls;

using MayhemWpf.UserControls;



namespace KeyModule
{

    public partial class KeyPressedControl : WpfConfiguration
    {
        private bool shouldCheckValidity = false; 

        public string Message
        {

            get;

            private set;

        }



        public KeyPressedControl(string message)
        {

            this.Message = message;

            InitializeComponent();

        }



        public override void OnLoad()
        {
            MessageBox.Text = this.Message;
            shouldCheckValidity = true; 
        }

        public override void OnSave()
        {
            //this.Message = (int)VolumeSlider.Value;
        }

        public override string Title
        {
            get { return "Enter Key"; }
        }

        private void MessageText_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (shouldCheckValidity)
            {
                Message = MessageBox.Text.Trim();
                CanSave = Message.Length > 0;
                textInvalid.Visibility = CanSave ? Visibility.Collapsed : Visibility.Visible;
            }
        }

    }
}
